#include <boost/multi_index_container.hpp>
#include <boost/multi_index/ordered_index.hpp>
#include <boost/multi_index/identity.hpp>
#include <boost/multi_index/member.hpp>

#include "junix.h"

struct employee
{
	int         id;
	std::string name;

	employee(int id,const std::string& name):id(id),name(name){}

	bool operator<(const employee& e)const{return id<e.id;}
};


// 定义一个按id和name进行索引和多索引set
typedef multi_index_container < employee,
		indexed_by<
		ordered_unique<identity<employee> >,
		ordered_non_unique<member<employee,std::string,&employee::name> > > > 
		employee_set;

void print_out_by_name(const employee_set& es)
{
  // 取得一个对索引#1(name)的视图
  const employee_set::nth_index<1>::type& name_index=es.get<1>();
  // 象一个普通的std::set那样使用name_index
  std::copy(
    name_index.begin(),name_index.end(),
    std::ostream_iterator<employee>(std::cout));
}

int main()
{
}
